#ifndef HTTPSERVER_H
#define HTTPSERVER_H

#include <defs/global.h>
#include <QtNetwork>

O_PRIVATE_DECLARE(HttpServer);
class HttpServer : public QTcpServer {
    Q_OBJECT
public:
	HttpServer(const QString& configKey, QObject *parent);
	~HttpServer();

protected:
    void incomingConnection(int socket);

private slots:
    void clientRead();
    void discardClient();
    void start();
 private:
    void processRequest(QTcpSocket* socket);
    QString js();
    QString html(bool dynamic = true);
    void sendHeader(QTcpSocket* socket, int code = 200, const QString& type = "", const QByteArray& content = QByteArray());
    O_PRIVATE_DECLARE_MEMBER(HttpServer);
};

#endif // HTTPSERVER_H

